<?php $url = new Url(); ?>
<div class="left">
    <?php $this->widget("AdminKetquaTrongngay")?>
    <?php $this->widget("AdminKetquaXoso")?>
</div>
<div class="right-main">
    <div class="righ-cont">
        <div class="right">
            <div class="title_style">
                <span><b>Kết quả Xổ Số điện toán 123 trong ngày </b></span></div>
                <?php
                $arr_date = explode("/",$row["ngay_quay"]);
                $date_format = $arr_date[2]."-".$arr_date[1]."-".$arr_date[0];
            ?>
            <div class="tablestyle clearfix">
                <table cellspacing="0" cellpadding="0" border="0" width="100%">
                    <tbody>   
                        <tr>
                            <td>
                                <div class="table clearfix">
                                    <table cellspacing="0" cellpadding="0" border="0" width="100%">
                                        <tbody>   

                                            <tr class="bg_gray">
                                                <td><strong class="clblue">Mở thưởng ngày: <?=$row["ngay_quay"] ?></strong></td>
                                            </tr>
                                            <tr>
                                                <td width="36%">
                                                    <b class="clblue">
                                                        <input type="text" id="ketqua" value="<?=isset($row["ketqua"]) ? $row["ketqua"]:"" ?>" />
                                                    </b>
                                                    <span id="save" ></span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="bg_yellow"><a class="save" href="javascript:void(0)" onclick="saveKetqua();"> Save</a></td>
                                            </tr>

                                        </tbody>
                                    </table>
                                </div>
                            </td>
                            <td width="60"><a href="#" class="next"></a></td>
                            <td>
                                <div class="table clearfix">
                                    <table cellspacing="0" cellpadding="0" border="0" width="100%">
                                        <tbody>   

                                            <tr class="bg_gray">
                                                <td><strong class="clblue">Mở thưởng ngày: <?=$row["ngay_quay"] ?></strong></td>
                                            </tr>
                                            <tr>
                                                <td width="36%">
                                                    <b class="clblue" id="kq"><?=isset($row["ketqua"]) ? $row["ketqua"]:"&nbsp;"?></b>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var ngay_quay = '<?=$row["ngay_quay"]?>';

    function saveKetqua(){
        var divId1 = "save";
        var divId2 = "kq";
        var label = "ketqua";
        var ketqua = $("#ketqua").val();
        var strUrl = '<?=$url->createUrl("trongngay/saveThantai") ?>';

        $.ajax({
            type: "POST",
            url: strUrl,
            data: {
                label:label,
                ketqua:ketqua,
                ngay_quay:ngay_quay
            },
            success: function(msg){
                $("#"+divId1).removeClass("loading");
                if(msg==1){                   
                    $("#"+divId1).html("OK");
                    $("#"+divId2).html(ketqua);                  
                }else{
                    $("#"+divId1).html("Loi");
                }       
            },
            beforeSend:function(){
                $("#"+divId1).html("");
                $("#"+divId1).addClass("loading");
            }
        });    

    }
</script>
